<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增岗位')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-post-add">
		<div class="form-group">
			<label class="col-sm-3 control-label">公告类型名称：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="tname" id="tname" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label ">公告类型说明：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="tdesc" id="tdesc" required>
			</div>
		</div>
	</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
	var prefix = ctx + "notice/type";

	$("#form-post-add").validate({
		onkeyup: false,
		rules:{
			postName:{
				remote: {
					url: ctx + "notice/type/checkNoticeTypeNameUnique",
					type: "post",
					dataType: "json",
					data: {
						"tname" : function() {
							return $.common.trim($("#tname").val());
						}
					},
					dataFilter: function(data, type) {
						return $.validate.unique(data);
					}
				}
			},
			postSort:{
				digits:true
			},
		},
		messages: {
			"postName": {
				remote: "公告类型名称已经存在"
			}
		},
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/add", $('#form-post-add').serialize());
		}
	}
</script>
</body>

</html>
